package com.itheima.d3_abstract;

public class Test3 {
    public static void main(String[] args) {
        String s = "wechay";
        OnlinePay pay = null;
        if (s.equals("abc")){
            pay = new AbcPay();
        } else if (s.equals("wechay")) {
            pay = new WechayPay();
        }

        pay.pay(150.25);
    }
}

abstract class OnlinePay {
    public abstract void pay(double money);
}

class AbcPay extends OnlinePay {
    @Override
    public void pay(double money) {
        System.out.println("走农行的支付接口");
    }
}

class WechayPay extends OnlinePay {
    @Override
    public void pay(double money) {
        System.out.println("走微信支付接口");
    }
}